//    Copyright (C) Clear Office.  All rights reserved.
using System;
using Office.Core.Serialization;

namespace Office.Spreadsheet
{
    class CellFormula: IOfficeXmlSerializable
    {
        

        public string Text;
        private CellFormulaType type;

        public CellFormulaType Type
        {
            get { return type; }
            set { type = value; }
        }
        private string reference;

        public string Reference
        {
            get { return reference; }
            set { reference = value; }
        }

        private bool dt2D;

        public bool Dt2D
        {
            get { return dt2D; }
            set { dt2D = value; }
        }

        private bool dtr;

        public bool Dtr
        {
            get { return dtr; }
            set { dtr = value; }
        }
        public bool del1;
        public bool del2;

        public string r1;

        public string r2;

        public bool d;

        public bool ca;

        public bool fill;

        public bool ce;

        public int si;
        internal bool aca;

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            //\\using (ReadContext c = context.Read("f"))
            ReadContext c = context;
            {

                type = c.GetOptionalEnum("t", CellFormulaType.Normal);
                Reference = c.GetOptionalString("ref");
                dt2D = c.GetOptionalBoolean("dt2D", false);
                dtr = c.GetOptionalBoolean("dtr", false);
                del1 = c.GetOptionalBoolean("del1", false);
                del2 = c.GetOptionalBoolean("del2", false);
                //\\r1= c.GetOptionalBooleanAttribute("r1", false, reader);
                //\\r2= c.GetOptionalBooleanAttribute("r2", false, reader);
                d = c.GetOptionalBoolean("d", false);
                ca = c.GetOptionalBoolean("ca", false);
                aca = c.GetOptionalBoolean("aca", false);
                fill = c.GetOptionalBoolean("fill", false);
                ce = c.GetOptionalBoolean("ce", false);
                si = c.GetOptionalInteger("si", 0);
                c.PassAttributes();
                Text = c.ReadElementString("f");
            }

        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
